//10月11日 移动端拖拽大图滚动 
//div总窗口 ,  导航的点(数组) , 每个小窗口(数组)
//引用第一个swiper 方法; 样式自己写 position 定位在一排就可以
function datugundong(obj_min_wrap, obj_nav_dian_arr, div_page_wrap) {
	var thenX = 0; //开始点击的X坐标
	var index = 0; //记录当前显示出来的页面;
	obj_min_wrap.style.height = screenHeight * 0.2854076 + "px";
	obj_min_wrap.addEventListener("touchstart", start, false);
	obj_min_wrap.addEventListener("touchend", end, false);
	obj_nav_dian_arr[index].style.backgroundColor = "rgb(169,169,169)";
}

function start(ev) {
	var event = ev || window.event;
	thenX = event.changedTouches[0].pageX;
}

function end(ev) {
	var event = ev || window.event;
	event.preventDefault()
	var nowX = event.changedTouches[0].pageX;
	if(nowX > thenX) {
		if(div_page_wrap[0].offsetLeft >= 0) {
			console.log("到头了");
		} else {
			for(var i = 0; i < div_page_wrap.length; i++) {
				Scroll(div_page_wrap[i], false);
			}
			index--;
			for(var i = 0; i < obj_nav_dian_arr.length; i++) {
				obj_nav_dian_arr[i].style.backgroundColor = "";
			}
			obj_nav_dian_arr[index].style.backgroundColor = "rgb(169,169,169)";
		}
	} else if(nowX < thenX) {
		if(div_page_wrap[obj_nav_dian_arr.length-1].offsetLeft > 0) {
			for(var i = 0; i < div_page_wrap.length; i++) {
				Scroll(div_page_wrap[i], true);
			}
			index++;
			for(var i = 0; i < obj_nav_dian_arr.length; i++) {
				obj_nav_dian_arr[i].style.backgroundColor = "";
			}
			obj_nav_dian_arr[index].style.backgroundColor = "rgb(169,169,169)";
		} else {
			console.log("到头了");
		}
	}
	obj_min_wrap.removeEventListener("touchstart", start, false);
	obj_min_wrap.removeEventListener("touchend", end, false);
	setTimeout(function() {
		obj_min_wrap.addEventListener("touchstart", start, false);
		obj_min_wrap.addEventListener("touchend", end, false);
	}, 1000);
}

function Scroll(obj, bol) {
	if(bol) {
		//					//左滑
		obj.style.left = obj.offsetLeft - screenWidth + "px";
	} else {
		//					//右滑
		obj.style.left = obj.offsetLeft + screenWidth + "px";
	}
}